package cp3120.view;

import cp3120.dao.DAOFactory;
import cp3120.model.Role;
import generic.swing.ListView;
import java.util.List;

/**
 *
 * @author Adam Scarr <scarr.adam@gmail.com>
 */
public class RoleListView extends ListView<Role> {

    public RoleListView() {
        setTitle("Role Manager");
    }

    protected List<Role> getList() {
        return DAOFactory.getUserDAO().getRoles();
    }

    protected void delete(Role object) {
        DAOFactory.getUserDAO().deleteRole(object);
    }

    protected void edit(Role object) {
        new RoleEditor(object).setVisible(true);
    }

    protected void add() {
        new RoleEditor(new Role()).setVisible(true);
    }

    protected void ok() {
        dispose();
    }
}
